TARGET = turtle

turtle: turtle.cmo lexer.cmo main.cmo
	ocamlc -thread graphics.cma unix.cma threads.cma -o $@ lexer.cmo turtle.cmo main.cmo

turtle.cmo: turtle.ml turtle.cmi
	ocamlc -c turtle.ml

%.cmo: %.ml
	ocamlc -c $<

lexer.ml: lexer.mll
	ocamllex $<

turtle.ml: turtle.mly
	ocamlyacc $< 
	echo "\nval current_state: unit -> (float * float * float)" >> turtle.mli

turtle.cmi: turtle.mli
	ocamlc -c $<

clean:
	rm -rf *.cmi *.cmo $(TARGET)
	rm -rf turtle.ml turtle.mli lexer.ml lexer.mli

# TARGET = turtle

# turtle: lexer.cmo turtle.cmo main.cmo
# 	ocamlc -thread graphics.cma unix.cma threads.cma -o $@ lexer.cmo turtle.cmo main.cmo

# depend:
# 	ocamldep *.ml *.mli > .depend

# lex.ml: parser.cmi

# clean:
# 	rm -rf *.cmi *.cmo $(TARGET)
# 	rm -rf turtle.ml turtle.mli lexer.ml lexer.mli

# .SUFFIXES: .ml .mli .mll .mly .cmo .cmi

# .ml.cmo:
# 	ocamlc -c $<
# .mli.cmi:
# 	ocamlc -c $<
# .mll.ml:
# 	ocamllex $<
# .mly.ml:
# 	ocamlyacc $<
# .mly.mli:
# 	ocamlyacc $<

# include .depend
